﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using GameLibrary.Unit;

namespace UserInterface.Helpers
{
    public class UnitInfomation
    {
        public string ID { get; private set; }
        public string HP { get; private set; }
        public string AP { get; private set; }
        public string Attack { get; private set; }
        public string Defence { get; private set; }
        public string AttackRange { get; private set; }
        public string Owner { get; private set; }

        public UnitInfomation(UnitInfo info)
        {
            this.Defence = this.GetRatioString(info.Current.Defence,info.Template.Defence);
            this.ID = this.GetSingleItemString(info.ID);
            this.HP = this.GetRatioString(info.Current.HP, info.Template.HP);
            this.AP = this.GetRatioString(info.Current.AP, info.Template.AP);
            this.Attack = this.GetRatioString(info.Current.Attack,info.Template.Attack);
            this.AttackRange = this.GetSingleItemString(info.Template.AttackRange);
            this.Owner = this.GetSingleItemString(info.OwnerID);
        }

        private string GetRatioString(double numerator, double dominator)
        {
            return ((long)numerator).ToString() + "/" + ((long)dominator).ToString();
        }
        private string GetSingleItemString(double item)
        {
            return ((long)item).ToString();
        }

    }
}
